package main

import (
	"io/ioutil"
	"os"
	"strings"
)

func CreateFolder() {
	err := os.Mkdir("files/", os.ModePerm)
	if err != nil {
		println("创建文件夹时出错:", err)
		return
	}
}
func writeCharacterToFile(character string) error {
	f, err := os.OpenFile("character.txt", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
	if err != nil {
		if os.IsNotExist(err) {
			f, err = os.Create("character.txt")
			if err != nil {
				return err
			}
		} else {
			return err
		}
	}
	defer f.Close()

	_, err = f.WriteString(character)
	if err != nil {
		return err
	}
	return nil
}
func readCharactersFromFile() string {
	content, _ := ioutil.ReadFile("character.txt")
	return string(content)
}
func findCharactersNotInB(A, B string) string {
	notFound := make([]string, 0)
	for _, char := range A {
		if !strings.ContainsRune(B, char) {
			notFound = append(notFound, string(char))
		}
	}
	return strings.Join(notFound, "")
}
